package com.jt.web.service;

import com.jt.web.mapper.UserMapper;
import com.jt.web.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;

@Service
public class UserServiceImpl implements UserService{
    @Autowired
    private UserMapper userMapper;

    @Override
    public String Login(User user) {
        String password = DigestUtils.md5DigestAsHex(user.getPassword().getBytes());
        user.setPassword(password);
        User user1 = userMapper.login(user);
        if(user1 == null)
            return null;
        String token = user1.getPassword() + " " + user1.getUserName();
        return token;
    }
}
